home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_vim.idb / usr / freeware / share / vim / syntax / lex.vim.z / lex.vim
Encoding:
Text File  |  1998-10-28  |  3.9 KB  |  67 lines

  1. " Vim syntax file
  2. " Language:      Lex
  3. " Maintainer:    Dr. Charles E. Campbell, Jr. <cec@gryphon.gsfc.nasa.gov>
  4. " Last change:    January 30, 1998
  5.  
  6. " Remove any old syntax stuff hanging around
  7. syn clear
  8.  
  9. " Read the C syntax to start with
  10. so <sfile>:p:h/c.vim
  11.  
  12. " <c.vim> includes several ALLBUTs; these have to be treated carefully
  13. syn clear cParen cDefine cPreProc cMulti
  14. syn region cParen start='(' end=')' transparent contains=ALLBUT,cParenError,cIncluded,cSpecial,cTodo,cUserLabel,lexAbbrv,lexAbbrvBlock,lexAbbrvRegExp,lexInclude,lexPat,lexPatBlock,lexPatCode,lexPatRegExp,lexPatTag,lexPatComment,lexPatTagRE
  15. syn region cDefine        start="^\s*#\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,cPreCondit,cIncluded,cInclude,cDefine,cInParen,lexAbbrv,lexAbbrvBlock,lexAbbrvRegExp,lexInclude,lexPat,lexPatBlock,lexPatCode,lexPatRegExp,lexPatTag,lexPatComent,lexPatTagRE
  16. syn region cPreProc        start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" contains=ALLBUT,cPreCondit,cIncluded,cInclude,cDefine,cInParen,lexAbbrv,lexAbbrvBlock,lexAbbrvRegExp,lexInclude,lexPat,lexPatBlock,lexPatCode,lexPatRegExp,lexPatTag,,lexPatComent,lexPatTagRE
  17. syn region cMulti        transparent start='?' end=':' contains=ALLBUT,cIncluded,cSpecial,cTodo,cUserLabel,lexAbbrv,lexAbbrvBlock,lexAbbrvRegExp,lexInclude,lexPat,lexPatBlock,lexPatCode,lexPatRegExp,lexPatTag,lexPatComent,lexPatTagRE
  18.  
  19. " --- Lex stuff ---
  20.  
  21. " Abbreviations Section
  22. syn region lexAbbrvBlock    start="^\([a-zA-Z_]\+\t\|%{\)" end="^%%$"me=e-2        skipnl                nextgroup=lexPatBlock contains=lexAbbrv,lexInclude
  23. syn match  lexAbbrv            "^[a-zA-Z_][a-zA-Z_0-9]*\s"me=e-1                    contained skipwhite    nextgroup=lexAbbrvRegExp
  24. syn match  lexAbbrv            "^%[sx]"                                            contained
  25. syn match  lexAbbrvRegExp    "\s\S.*$"lc=1                                        contained             nextgroup=lexAbbrv,lexInclude
  26. syn region lexInclude        matchgroup=lexSep    start="^%{" end="%}"            contained            contains=ALLBUT,lexAbbrv,lexAbbrvBlock,lexAbbrvRegExp,lexInclude,lexPat,lexPatBlock,lexPatCode,lexPatRegExp,cParenError,cInParen,lexPatComent,lexPatTagRE
  27.  
  28. "%% : Patterns {Actions}
  29. syn region lexPatBlock        matchgroup=Todo    start="^%%$" matchgroup=Todo end="^%%$"    skipnl contains=lexPat,lexPatRegExp,lexPatTag,lexPatComment
  30. syn region lexPat matchgroup=String    start=+"+ skip=+\(\\\\\)*\\"+ matchgroup=String end=+"+ contained skipwhite nextgroup=lexMorePat,lexPatCode
  31. syn region lexPatRegExp        start=+^[^"].\{-}+me=e-1    end="\t"me=e-1                contained skipwhite nextgroup=lexPatCode
  32. syn match  lexPatTag        "^<[a-zA-Z]\+>"                                            contained nextgroup=lexPat,lexMorePat,lexPatTagRE
  33. syn region lexPatTagRE        start=+[^\t]+                end="\t"me=e-1                contained skipwhite nextgroup=lexPatCode
  34. syn region lexPatTagRE matchgroup=String start=+"+    matchgroup=String end=+"\s+me=e-1        contained skipwhite nextgroup=lexPatCode
  35. syn region lexPatComment    start="^\s*/\*"                end="\*/"                    skipnl contains=cTodo nextgroup=lexPatComment,lexPat,lexPatTag
  36. syn match  lexMorePat        "\s*|\s*$"                                                contained nextgroup=lexPat
  37. syn region lexPatCode matchgroup=Delimiter start="{" matchgroup=Delimiter end="}"     contained contains=ALLBUT,lexAbbrv,lexAbbrvBlock,lexAbbrvRegExp,lexInclude,lexPat,lexPatBlock,lexPatCode,lexPatRegExp,lexPatComent,lexPatTagRE
  38.  
  39. syn keyword lexFunctions    BEGIN    input    unput    woutput    yyleng    yylook    yytext
  40. syn keyword lexFunctions    ECHO    output    winput    wunput    yyless    yymore    yywrap
  41.  
  42. " Synchronization
  43. syn sync clear
  44. syn sync minlines=300
  45. syn sync match lexSyncPat    grouphere    lexAbbrvBlock    "^%%$"
  46. syn sync match lexSyncPat    groupthere    lexPatBlock        "^%%$"
  47.  
  48. if !exists("did_lex_syntax_inits")
  49.   let did_lex_synax_inits = 1
  50.   hi link    lexAbbrvRegExp    lexRegExp
  51.   hi link    lexPatRegExp    lexRegExp
  52.   hi link    lexPatTagRE        lexRegExp
  53.  
  54.   hi link    lexAbbrv        SpecialChar
  55.   hi link    lexFunctions    Function
  56.   hi link    lexMorePat        Comment
  57.   hi link    lexPat            Function
  58.   hi link    lexPatComment    Comment
  59.   hi link    lexPatTag        Special
  60.   hi link    lexRegExp        Macro
  61.   hi link    lexSep            Delimiter
  62. endif
  63.  
  64. let b:current_syntax = "lex"
  65.  
  66. " vim:ts=4
  67.